<template>
  <div class="bulletin">
    <el-form label-width="130px" @submit.native.prevent="Create()">
      <el-form-item label="场馆编号">
        <el-input v-model="venue_id" placeholder="场馆编号" />
      </el-form-item>
      <el-form-item label="日期编号">
        <el-input v-model="meet_day_id" placeholder="日期编号" />
      </el-form-item>
      <el-form-item label="开始时间">
        <el-input v-model="start" placeholder="开始时间" />
      </el-form-item>
      <el-form-item label="结束时间">
        <el-input v-model="end" placeholder="结束时间" />
      </el-form-item>
      <el-form-item label="是否限制人数">
        <el-select v-model="is_limit">
          <el-option :value="0" label="否" />
          <el-option :value="1" label="是" />
        </el-select>
      </el-form-item>
      <el-form-item label="报名上限">
        <el-input v-model="limit" placeholder="报名上限" />
      </el-form-item>
      <el-form-item label="PublisherUid">
        <el-input v-model="publisher_uid" placeholder="PublisherUid" />
      </el-form-item>
      <el-form-item label="发布时间">
        <el-date-picker
          v-model="created_at"
          type="datetime"
          placeholder="选择发布时间"
          value-format="yyyy-MM-dd HH:mm:ss"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" native-type="submit">提交</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import SingleImage from '@/components/Upload/SingleImage'
import Tinymce from '@/components/Tinymce'
import { parseTime } from '@/utils/index'
export default {
  components: {
    Tinymce,
    SingleImage
  },
  data() {
    return {
      venue_id: '',
      meet_day_id: '',
      start: '',
      end: '',
      is_limit: '',
      limit: '',
      publisher_uid: '',
      created_at: parseTime(new Date().getTime())
    }
  },
  methods: {
    Create() {
      const params = {
        venue_id: this.venue_id,
        meet_day_id: this.meet_day_id,
        start: this.start,
        end: this.end,
        is_limit: this.is_limit,
        limit: this.limit,
        publisher_uid: this.publisher_uid,
        created_at: this.created_at
      }
      this.$http
        .post('meet_hours', params)
        .then(response => {
          this.$success('操作成功')
          this.$router.push('meet/meet-hours')
        })
        .catch(response => {
          this.$error(response)
        })
    }
  }
}
</script>

<style>
.bulletin .el-progress-circle {
  background: #fff;
}
.avatar-uploader {
  position: relative;
}
.avatar-uploader .percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  max-width: 500px;
  display: block;
}
</style>
